package jiali.test.easyfactory_2;

public class CashReturn extends CashSuper{
    private double moneyCondition = 0d;
    private double moneyReturn = 0d;

    public CashReturn(double moneyCondition, double moneyReturn) {
        this.moneyCondition = moneyCondition;
        this.moneyReturn = moneyReturn;
    }

    @Override
    public double acceptCash(double price, int num) {
        double resultMoney = price * num;
        if (resultMoney >= moneyCondition) {
            resultMoney -= moneyReturn;
        }
        return resultMoney;
    }
}
